﻿@{
    ViewBag.Title = HttpContext.GetGlobalResourceObject("StringResources", "InstallerStartTitle");
}

<div id="page-title">
    <h2>@HttpContext.GetGlobalResourceObject("StringResources", "InstallerStartTitle")</h2>    
</div>

<div id="page-sub-title">
    <h3>@HttpContext.GetGlobalResourceObject("StringResources", "InstallerStartIntroduction")</h3>
</div>

@Html.Partial("Navigation/MainMenuInstaller")

<div id="page-content">
    
    <p>@HttpContext.GetGlobalResourceObject("StringResources", "InstallerDatabaseIntroductionParagraphSupportedSystems")</p>
    <p>@HttpContext.GetGlobalResourceObject("StringResources", "InstallerDatabaseIntroductionParagraphRequirements")</p>

    <div class="form-container detached">

        <div class="input-area">
            <div class="input-area-label">
                <label for="">@HttpContext.GetGlobalResourceObject("StringResources", "FormInstallerDatabaseInstanceLabel")</label>
            </div>
            <div class="input-area-field">
                <input type="text" id="form-installation-database-instance" name="form-installation-database-instance" value="" />
            </div>
        </div>

        <div class="input-area">
            <div class="input-area-label">
                <label for="">@HttpContext.GetGlobalResourceObject("StringResources", "FormInstallerDatabaseDatabasenameLabel")</label>
            </div>
            <div class="input-area-field">
                <input type="text" id="form-installation-database-databasename" name="form-installation-database-databasename" value="" />
            </div>
        </div>

        <div class="input-area">
            <div class="input-area-label">
                <label for="">@HttpContext.GetGlobalResourceObject("StringResources", "FormInstallerDatabaseUsernameLabel")</label>
            </div>
            <div class="input-area-field">
                <input type="text" id="form-installation-database-username" name="form-installation-database-username" value="" />
            </div>
        </div>

        <div class="input-area">
            <div class="input-area-label">
                <label for="">@HttpContext.GetGlobalResourceObject("StringResources", "FormInstallerDatabasePasswordLabel")</label>
            </div>
            <div class="input-area-field">
                <input type="text" id="form-installation-database-password" name="form-installation-database-password" value="" />
            </div>
        </div>

    </div>

    <p class="input-area-buttons alignleft">
        <input 
            type="button" 
            role="link" 
            onclick="javascript: window.location.href = '@Url.Action("Start", "Installer")';"
            title="@HttpContext.GetGlobalResourceObject("StringResources", "InstallerDatabaseButtonBackToStart")" 
            value="@HttpContext.GetGlobalResourceObject("StringResources", "InstallerDatabaseButtonBackToStart")" />
        <input 
            type="button" 
            role="link" 
            class="input-area-button-submit" 
            onclick="javascript: performDatabaseSetup(this);"
            title="@HttpContext.GetGlobalResourceObject("StringResources", "InstallerDatabaseButtonPerformSetup")" 
            value="@HttpContext.GetGlobalResourceObject("StringResources", "InstallerDatabaseButtonPerformSetup")" />
    </p>

</div>

<script type="text/javascript">
    function performDatabaseSetup(sender) {
        showMessagebox(
            '@Html.Raw(ViewBag.AjaxLoadingMessage) @HttpContext.GetGlobalResourceObject("StringResources", "InstallerDatabasePerformSetupDialogTitle")', 
            '@HttpContext.GetGlobalResourceObject("StringResources", "InstallerDatabasePerformSetupDialogMessage")', 
            '', 
            'loading'
        );

        $.ajax({
            type: 'POST',
            url: '@Url.Action("PerformDatabaseSetup", "Installer")',
            data: {
            },
            success: function (data) {},
            error: function (jqXhr) {
                showMessagebox(
                    '@HttpContext.GetGlobalResourceObject("StringResources", "InstallerDatabasePerformSetupDialogTitleError")', 
                    '@HttpContext.GetGlobalResourceObject("StringResources", "InstallerDatabasePerformSetupDialogMessageError") <br /> HTTP ' + jqXhr.status + ': ' + jqXhr.statusText, 
                    'red', 
                    'info'
                );
            }
        });

        return true;
    }
</script>